/**
 * The Panel user-interface component class
 * @class syslib.ui.Panel
 * @author Gabriel Ricci
 */
syslib.ui.Panel = __class(syslib.ui.VisualTag, 
/**
 * @lends syslib.ui.Panel
 */ 
{
	// some class attributes
	id : "",
	title : "", 

	prepare : function(){
		// set some important stuff
		this.id = "";
		this.title = "";
		
		// set the id
		this.id = (__valid(this.__attributes.id)) ? this.__attributes.id : "panel_"  + Math.floor(Math.random() * 101);
		this.title = (__valid(this.__attributes.title)) ? this.__attributes.title : "Untitled Panel";
		
		// load the style
		syslib.loadStyleForComponent("panel");
		
		// return
		return true;
	},

	execute : function(element){
		// set the attributes of the element
		var attributes	= syslib.object.extend(this.__attributes, {
			"class" : "panel-container", 
			"title" : false
		});
		
		// create the json structure
		elemtJSON = ["div", attributes, 
			["div", {"class" : "panel-header"}, 
				this.title
			], 
			["div", {"class" : "panel-body"}, 
				this.__innerHTML
			]
		];

		// create the element
		var panel = this.createDOM(elemtJSON);
		delete elemtJSON;
		
		// return
		return panel;
	},

	finalize: function(){
		// return
		return true;
	}
});